package com.cn.rzx.system.controller;

import javax.annotation.Resource;

import com.cn.rzx.base.controller.BaseController;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSONObject;
import com.cn.rzx.system.pojo.User;
import com.cn.rzx.system.service.IUserService;

import java.util.Map;

@Controller
@RequestMapping("/system/user")
public class UserController extends BaseController {
	private static final Logger logger = LoggerFactory.getLogger(UserController.class);

	@Resource
	private IUserService userService;
	
	@RequestMapping("/getUserById")
	@ResponseBody
	public Map<String, Object> getUser(int userId) {
		logger.info("我进来了info====userId:{}",userId);
		logger.debug("我进来了debug====userId:{}",userId);
		User user = userService.getUserById(userId);
		return getResultMap(user);
	}

	@RequestMapping("/setDebug")
	@ResponseBody
	public Map<String, Object> setDebug() {
		logger.debug("生成了一条debug日志============");
		String msg = "生成了一条debug日志============";
		return getResultMap(msg);
	}

	@RequestMapping("/setInfo")
	@ResponseBody
	public Map<String, Object> setInfo() {
		logger.info("生成了一条info日志============");
		String msg = "生成了一条info日志============";
		return getResultMap(msg);
	}

	@RequestMapping("/setError")
	@ResponseBody
	public Map<String, Object> setError() {
		logger.error("生成了一条error日志============");
		String msg = "生成了一条error日志============";
		return getResultMap(msg);
	}
}
